<template>
    <div class="main-right">
      <Nav title="最新动态"  path="/infoList" />
      <div class="right-nr">
            <ul class="data-list">
                <li v-for="item in newsList" :key="item.id" @click="toDetail(item)">
                    <p>{{item.title}}</p>
                    <span>{{item.ttime}}</span>
                </li>
            </ul>
      </div>
    </div>
  </template>  
  <script>
  import Nav from "./components/nav"
  export default {
      components:{
          Nav
      },
      data(){
          return {
            newsList:[]
          }
      },
      created(){
          this.getNews();
      },
      methods:{
        // 首页获取轮播列表
        getNews(){
            this.centralControl.axios.centralControl(
                'getNews',
                res => {
                    this.newsList=res;
                },
                {}
            );
        },
        toDetail(item){
            localStorage.setItem('infoDetail',JSON.stringify(item))
            this.$router.push("/infoDetail") 
        },
      }
  }
  </script>
  <style lang="less" scoped>
  .right-nr {
      font-size: 16px;
      color: #666;
      position: relative;
      padding-bottom: 50px;
  }
.data-list {
    padding-top: 5px;
    padding-bottom: 30px;
}
.data-list li {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    line-height: 45px;
    border-bottom: 1px dotted #ccc;
    cursor: pointer;
}
ul.data-list > li > p {
    color: #333;
    font-size: 16px;
    /* float: left; */
    background: url(../../assets/img/lia.png) no-repeat left center;
    padding-left: 12px;
}
.data-list li span {
    font-size: 16px;
    color: #666;
    /* float: right; */
}
  </style>